package com.jeady.jxcompose

import android.content.Context
import android.widget.Toast
import java.text.SimpleDateFormat
import java.time.LocalDateTime
import java.util.Locale

object Utils {
    fun currentTime():Long{
        return System.currentTimeMillis()
    }
    fun currentTimeString():String{
        return LocalDateTime.now().toString()
            .substringBefore(".").replace("T", " ")
    }

    fun formatDateTime(ms: Long, format: String="yyyy-MM-dd HH:mm:ss"): String{
        return SimpleDateFormat(format, Locale.US).format(ms).toString()
    }

    fun showToast(context: Context, title: String){
        Toast.makeText(context, title, Toast.LENGTH_SHORT).show()
    }
}